﻿@inherits Blazorise.FileEdit
<Control Role="ControlRole.File">
    <input @ref="@ElementRef" id="@ElementId" type="file" class="@ClassNames" webkitdirectory="@Directory" style="@StyleNames" disabled="@IsDisabled" readonly="@ReadOnly" multiple="@Multiple" accept="@Filter" tabindex="@TabIndex" @onkeydown="@OnKeyDownHandler" @onkeypress="@OnKeyPressHandler" @onkeyup="@OnKeyUpHandler" @onblur="@OnBlurHandler" @onfocus="@OnFocusHandler" @onfocusin="@OnFocusInHandler" @onfocusout="@OnFocusOutHandler" @attributes="@Attributes" />
    <Label Type="LabelType.File" For="@ElementId" data-browse="@BrowseButtonString">
        @if ( !HasSelectedFileNames && Placeholder != null )
        {
            <Span TextColor="TextColor.Muted">
                @Placeholder
            </Span>
        }
        else
        {
            @SelectedFilenamesString
        }
        @ChildContent
    </Label>
    @Feedback
</Control>
@code{
    string SelectedFilenamesString => string.Join( ", ", SelectedFileNames );

    bool HasSelectedFileNames => SelectedFileNames.Any();
}